package com.xyh.service.impl;

import com.xyh.dao.UserMapper;
import com.xyh.pojo.User;
import com.xyh.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;
    @Override
    public User checkUser(String username, String password) {
        return userMapper.checkUser(username,DigestUtils.md5DigestAsHex(password.getBytes()));
    }

    @Override
    public int updatePassword(String password) {
        System.out.println(DigestUtils.md5DigestAsHex(password.getBytes()));
        return userMapper.updatePassword(DigestUtils.md5DigestAsHex(password.getBytes()));
    }
}
